// @ts-nocheck
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import notFound from '../views/notFound.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Home',
    component: Home,
    // redirect:'/backstage',    
    meta: {
      requireAuth: false,
      keepAlive:true
    },
  },
  {
    path: '/order',
    component: () => import( /* webpackChunkName: "order" */ '../views/Order.vue'),
    meta: {
      requireAuth: true
    }
  },
  {
    path: '/aplay',
    component: () => import( /* webpackChunkName: "order" */ '../views/Aplay.vue'),
    meta: {
      requireAuth: true
    }
  },
  // 后台登录页面
  // {
  //   path: '/backstage/login',
  //   component: () => import( /* webpackChunkName: "login" */ '../views/backstage/login.vue'),
  //   meta: {
  //     requireAuth: false
  //   }

  // }, 

  {
    path: '/detailed',
    component: () => import( /* webpackChunkName: "Detailed" */ '../views/Detailed.vue'),
    name:"details",
    meta: {
      // requireAuth: false,
      keepAlive:false
    }
  },

  // 测试分页功能
  // {
  //   path:"/page",
  //   component: () => import( /* webpackChunkName: "page" */ '@/testing/Page.vue')
  // },
  {
    // 后台管理的首页
    path: '/backstage',
    // name: 'Home',
    component: () => import( /* webpackChunkName: "backage" */ '../views/backstage/Index.vue'),
    redirect: '/goods/Goods',
    meta: {
      requireAuth: true
    },
    children: [{
        path: '/goods/Goods',
        component: () => import( /* webpackChunkName: "GOOD" */ '../views/backstage/goods/Goods.vue'),
        meta: {
          requireAuth: true,
          keepAlive:true
        },
      }, {
        path: '/pay/Order',
        component: () => import( /* webpackChunkName: "order" */ '../views/backstage/pay/Order.vue'),
        meta: {
          requireAuth: true
        },
      }, {
        path: '/system/user',
        component: () => import( /* webpackChunkName: "user" */ '../views/backstage/system/user.vue'),
        meta: {
          requireAuth: true
        },
      },{
        path: '/system/city',
        component: () => import( /* webpackChunkName: "city" */ '../views/backstage/system/city.vue'),
        meta: {
          requireAuth: true
        },
      }, {
        path: '/system/Dept',
        component: () => import( /* webpackChunkName: "Dept" */ '../views/backstage/system/Dept.vue'),
        meta: {
          requireAuth: true
        },
      }, {
        path: '/charts/statistics',
        component: () => import( /* webpackChunkName: "statistics" */ '../views/backstage//charts/statistics.vue'),
        meta: {
          requireAuth: true
        },

      },

    ]
  },
  {
    path: '/login',
    component: () => import( /* webpackChunkName: "order" */ '../views/Login.vue'),
    meta: {
      requireAuth: false
    },
  },
  {
    path: '/register',
    component: () => import( /* webpackChunkName: "order" */ '../views/Register.vue'),
    meta: {
      requireAuth: false
    },
  },
  {
    path: '/text',
    component: () => import( /* webpackChunkName: "order" */ '../views/text.vue'),
    meta: {
      requireAuth: false
    },
  },
  //通常使用通配符进行配置404页面
  {
    path: '*',
    component: notFound
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router;